namespace ClientManager.Data.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class init : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Clients",
                c => new
                    {
                        ClientId = c.Int(nullable: false, identity: true),
                        FirstName = c.String(),
                        Surname = c.String(),
                        DateCreated = c.DateTime(nullable: false),
                        ServiceLevelId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.ClientId)
                .ForeignKey("dbo.ServiceLevels", t => t.ServiceLevelId, cascadeDelete: true)
                .Index(t => t.ServiceLevelId);
            
            CreateTable(
                "dbo.ServiceLevels",
                c => new
                    {
                        ServiceLevelId = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                    })
                .PrimaryKey(t => t.ServiceLevelId);

            Sql(@"
INSERT INTO ServiceLevels(Name) VALUES ('Bronze')
INSERT INTO ServiceLevels(Name) VALUES ('Silver')
INSERT INTO ServiceLevels(Name) VALUES ('Gold')");
            
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.Clients", "ServiceLevelId", "dbo.ServiceLevels");
            DropIndex("dbo.Clients", new[] { "ServiceLevelId" });
            DropTable("dbo.ServiceLevels");
            DropTable("dbo.Clients");
        }
    }
}
